<template>
  <div>
    <!-- 单一根，指令才能生效，必须 v-modaldrag --->

    <el-form :model="employee" ref="employeeForm" >


      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="姓名" name="name" ><el-input v-model:value="employee.name" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="证件类型" name="idCardType" ><el-input v-model:value="employee.idCardType" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="身份证号" name="idCardNumber" ><el-input v-model:value="employee.idCardNumber" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="性别" name="sex" ><el-input v-model="employee.sexCaption" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="出生日期" name="birthday" ><el-input v-model:value="employee.birthday" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="籍贯" name="birthplace" ><el-input v-model:value="employee.birthplace" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="电话" name="mobile" ><el-input v-model:value="employee.mobile" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="邮箱" name="email" ><el-input v-model:value="employee.email" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="岗位" name="jobTitle" ><el-input v-model:value="employee.jobTitle" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="学历" name="education" ><el-input v-model:value="employee.education" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="毕业学校" name="school" ><el-input v-model:value="employee.school" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="专业" name="speciality" ><el-input v-model:value="employee.speciality" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>

      <el-row :gutter="formGutter">

        <el-col :span="12"><el-form-item label="备注" name="remarks" ><el-input type='textarea' v-model="employee.remarks" readonly :autosize="true" :input-style="underlineElInputStyle" autosize/></el-form-item></el-col>



        <el-col :span="12"><el-form-item label="顺序号" name="ordnum" ><el-input v-model:value="employee.ordnum" readonly :input-style="underlineElInputStyle" /></el-form-item></el-col>

      </el-row>
    </el-form>


  </div>
</template>

<script lang="ts" setup>
/*
 * @author: user
 * @date: 2021-11-25 16:55:15
 * @template: dayu-code-builder
*/
import { onMounted, reactive, computed } from 'vue'
import {underlineElInputStyle} from '@/utils/constants';
import { Employee, employeeService } from '@/api/demo/EmployeeService'
import { IForm, formColGutter } from '@/common/FormModal'

const props = defineProps({
  id: Number
});
const formGutter = formColGutter;
/** 接口数据（和接口返回数据对应） */
const employeeData = reactive({employee:<Employee>{}, codeTypes:{}, nameTypes:{}});
/** 表单数据 */
const employee = computed(() => employeeData.employee);

/** 获取表单数据 */
async function getFormData() {
  if (!props.id) return;
  try {
    let response: any = await employeeService.getEmployeeBO(props.id as number);
    employeeData.employee = response.data.data || {};
    employeeData.codeTypes = response.data.codeTypes;
    employeeData.nameTypes = response.data.nameTypes;
  } catch (ex: any) {
    console.error("await error");
    console.error(ex);
  }
}

onMounted(() => {
  getFormData();
});


</script>

<style scoped>

</style>